package com.haixin.security.service.impl;

import com.haixin.security.bean.Permission;
import com.haixin.security.dao.PermissionMapper;
import com.haixin.security.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionServiceImpl implements PermissionService {

    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public void addPermission(Permission permission) {
        permissionMapper.insertPermission(permission);
    }

    @Override
    public void updatePermission(Permission permission) {
        permissionMapper.updatePermission(permission);
    }

    @Override
    public void deletePermission(int id) {
        permissionMapper.deletePermission(id);
    }

    @Override
    public Permission getPermissionById(int id) {
        return permissionMapper.selectPermissionById(id);
    }

    @Override
    public List<Permission> getAllPermissions() {
        return permissionMapper.selectAllPermissions();
    }
}
